package com.ibm.cps.demo;

import java.util.Date;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.google.common.base.Throwables;
import com.ibm.cps.storm.CPSTopology;
import com.ibm.util.LocalConfig;
/*
 * main driver to submit the topology.
 */
public class CPSTopologyDriver {

	public static void main(String[] args) throws Exception {
		Logger logger = Logger.getLogger(CPSTopologyDriver.class);
		try {
			PropertyConfigurator.configure(LocalConfig.getLoggerProperties());
			Date date = new Date();
			logger.info("Start topology in server at time " + date);

			if (args == null || args.length < 1) {
				System.err.println("Usage: program tenantid");
				System.exit(-1);
			}
			String tenantid = args[0];
			CPSTopology topology = new CPSTopology();
			topology.run(tenantid);
		} catch (Exception e) {
			logger.error(Throwables.getStackTraceAsString(e));
			throw e;
		}
	}
}
